#!/usr/bin/env python

import socket
import sys
import array
import struct

def txTest():
	m1 = int(5)
	m2 = int(10)
	m3 = int(15)
	packet_int = struct.pack("bbb", m1, m2, m3)
	s.send(packet_int)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

def alert(msg):
   print >>sys.stderr, msg
   sys.exit(1)


def connectSvr():
   ##host = raw_input('\nPlease enter the host address: ')
   host = '192.168.1.138'
   port = 50000
   size = 100

   try:
      s.connect((host,port))
      print '\nConnecting to server...\n'
   except Exception, e:
      alert('Something is wrong with %s:%d. Exception type is %s' % (host, port, e))
   print 'Connection Established!\n'

running = 1
connectSvr()
while running:
	uInput = raw_input('Junk and stuff\n')

	if uInput == 'e':
		running = 0
	else:
		txTest()
s.close()
exit()
	
